<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>023-计算属性-get-set.html</title>
</head>
<body>
	<div id="app">
		<input type="text" v-model="fullName" />
		<p>firstName:{{firstName}}</p>
		<p>lastName:{{lastName}}</p>
		<p>fullName:{{fullName}}</p>
	</div>
</body>
<script src="js/vue.js"></script>
<script>
	var vm = new Vue({
		el: '#app',
		data: {
			firstName:'Chris',
			lastName:'Els'
		},
		methods:{},
		computed:{
			/*
			fullName(){
				return this.firstName + '' + this.lastName
			}
			*/
			fullName: {
				get(){
					return this.firstName + ' ' + this.lastName
				},
				set(newValue){
					var names = newValue.split(' ')
					this.firstName = names[0]
					this.lastName = names[names.length -1]
				}
			}
		}

})
</script>
</html>